﻿Imports System.Data.SqlClient

Public Class ThamSoBUS
    Public Shared Function GetAll() As List(Of ThamSoDTO)
        Dim listThamSo As List(Of ThamSoDTO)

        listThamSo = ThamSoDAO.GetAll()

        Return listThamSo
    End Function
    Public Shared Function SLLoaiNha() As Integer
        Dim SoLuong As Integer

        SoLuong = ThamSoDAO.SoLuongLoaiNha()

        Return SoLuong
    End Function
    
    Public Shared Sub Update(ByVal soluongloainha As ThamSoDTO)

        Dim para As SqlParameter = New SqlParameter("SLLoaiNha ", SqlDbType.Int)
        para.Direction = ParameterDirection.Input
        para.Value = soluongloainha.iSLLoaiNha


        ThamSoDAO.Update(para)
    End Sub
    Public Shared Sub Update1(ByVal qd As ThamSoDTO)

        Dim para As SqlParameter = New SqlParameter("SLQuan ", SqlDbType.Int)
        para.Direction = ParameterDirection.Input
        para.Value = qd.iSoluongQuan

        Dim para1 = New SqlParameter("SLNhaTD ", SqlDbType.Int)
        para1.Direction = ParameterDirection.Input
        para1.Value = qd.iSLNhaToiDaMoiQuan


        ThamSoDAO.Update1(para, para1)

    End Sub


    Public Shared Function LaySLNhaToiDa() As Integer
        Dim iSLNhaToiDa As Integer
        iSLNhaToiDa = ThamSoDAO.LaySLNhaToiDa()
        Return iSLNhaToiDa
    End Function
    Public Shared Function LaySLQuanTD() As Integer
        Dim iSLQuanTD As Integer
        iSLQuanTD = ThamSoDAO.LaySLQuanTD()
        Return iSLQuanTD
    End Function
    Public Shared Function LaySLNhaTD() As Integer
        Dim iSLNhaToiDa As Integer
        iSLNhaToiDa = ThamSoDAO.LaySLNhaTD
        Return iSLNhaToiDa
    End Function
    Public Shared Function LaySLQuan_NhaTD() As ThamSoDTO
        Dim ThamSo As New ThamSoDTO()

        ThamSo = ThamSoDAO.LaySLQuan_SLNhaTD()

        Return ThamSo
    End Function
    Public Shared Function KiemTraDayDu(ByVal SoLuongLoaiNha As String)
        Dim kq As Boolean
        If Not SoLuongLoaiNha = "" Then

            kq = True
        Else
            kq = False
        End If

        Return kq
    End Function
    Public Shared Function KiemTraDayDu1(ByVal slquantoida As String, ByVal slnhatoida As String)
        Dim kq As Boolean
        If Not slquantoida = "" Then
            If Not slnhatoida = "" Then
                kq = True
            Else
                kq = False
            End If
        Else
            kq = False
        End If
        Return kq
    End Function


End Class
